﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ServicesMaintain.ascx.cs" Inherits="ERP.Modules.ServicesMaintain" %>
<%-------------------------------%>
<ext:Hidden ID="FormatTypeOrderServicesMaintain" runat="server" />
<%--------------GridOrderServicesMaintainBuy-----------------%>
<ext:Panel ID="PanelOrderServicesMaintain" runat="server" Layout="Fit" Border="False">
    <Content>
        <ext:GridPanel
            ID="grOrderServicesMaintain"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            BOrderServicesMaintain="False">
            <Store>
                <ext:Store
                    ID="StoreOrderServicesMaintain"
                    runat="server"
                    OnReadData="StoreOrderServicesMaintain_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model runat="server" IDProperty="Maintain_ID" GroupField="Customer_Name">
                            <Fields>
                                <ext:ModelField Name="Order_Sell_Id" Type="Int" />
                                <ext:ModelField Name="Customer_Name" Type="String" />
                                <ext:ModelField Name="Maintain_Code" Type="String" />
                                <ext:ModelField Name="Sell_Code" Type="String" />
                                <ext:ModelField Name="Maintain_TaxCode" Type="String" />
                                <ext:ModelField Name="Maintain_DateBegin" Type="Date" />
                                <ext:ModelField Name="Maintain_DateReview" Type="Date" />
                                <ext:ModelField Name="IsActive" Type="Boolean" />
                                <ext:ModelField Name="Employee_Id" Type="Int" />
                                <ext:ModelField Name="FullName" Type="String" />
                                <ext:ModelField Name="Employee_Id_Review" Type="Int" />
                                <ext:ModelField Name="FullName_Review" Type="String" />
                                <ext:ModelField Name="Note" Type="String" />
                                <ext:ModelField Name="Review" Type="Boolean" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn Text="STT" runat="server" Width="30" Align="Center" />
                    <ext:Column runat="server" Text="Mã phiếu bảo trì" Width="100" DataIndex="Maintain_Code"/>
                    <ext:Column runat="server" Text="CT bán hàng" Width="150" DataIndex="Sell_Code"/>
                    <ext:Column runat="server" Text="Khách hàng" Width="200" DataIndex="Customer_Name"/>
                    <ext:Column runat="server" Text="MS thuế" Width="100" DataIndex="Maintain_TaxCode" Align="Left"/>
                    <ext:Column runat="server" Text="Người lập phiếu" Width="150" DataIndex="FullName"/>
                    <ext:Column runat="server" Text="Người xét duyệt" Width="150" DataIndex="FullName_Review"/>
                    <ext:DateColumn runat="server" Text="Ngày bảo trì" Width="100" DataIndex="Maintain_DateBegin" Format="dd-MM-yyyy" Align="Center"/>
                    <ext:DateColumn runat="server" Text="Ngày xét duyệt" DataIndex="Maintain_DateReview" Format="dd-MM-yyyy" Align="Center" Width="100"/>
                    <ext:CheckColumn runat="server" Text="Trạng thái" DataIndex="Review" Align="Center" Flex="1"/>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping
                    runat="server" 
                    HideGroupedHeader="true"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <DirectEvents>
                <ItemDblClick OnEvent="OrderServicesMaintainDblClick">
                    <ExtraParams>
                        <ext:Parameter Name="Maintain_ID" Value="record.data.Maintain_ID" Mode="Raw" />
                    </ExtraParams>
                    <EventMask ShowMask="true" Msg="Đang tải..." />
                </ItemDblClick>
            </DirectEvents>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" Mode="Multi">
                    <Listeners>
                        <SelectionChange Handler="
                            if (selected.length == 0) {
                                #{btnEdit}.disable();
                                #{btnDel}.disable();
                                #{btnExport}.disable();
                                #{btnReviewMain}.disable();
                            } else {
                                #{btnEdit}.enable();
                                #{btnDel}.enable();
                                #{btnExport}.enable();
                                #{btnReviewMain}.enable();
                            }" />
                    </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <View>
                <ext:GridView runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnAddNew" runat="server" Text="Thêm mới" Icon="ApplicationAdd">
                            <DirectEvents>
                                <Click OnEvent="btnAddNew_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnEdit" runat="server" Text="Sửa" Icon="ApplicationEdit">
                            <DirectEvents>
                                <Click OnEvent="btnEdit_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnDel" runat="server" Text="Xoá" Icon="ApplicationDelete">
                            <DirectEvents>
                                <Click OnEvent="btnDel_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá mẫu tin này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnReviewMain" runat="server" Text="Xét duyệt" Icon="Tick" ToolTip="Check vào một phiếu đề nghị để xét duyệt">
                            <DirectEvents>
                                <Click OnEvent="btnReviewMain_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grOrderServicesMaintain}, #{FormatTypeOrderServicesMaintain}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:DateField ID="txtDateBeginFillter" EmptyText="Từ ngày" runat="server" MarginSpec="0 8 0 0"/>
                        <ext:DateField ID="txtDateEndFillter" EmptyText="Đến ngày" runat="server" MarginSpec="0 5 0 0"/>
                        <ext:Button ID="btnFillter" runat="server" Text="Lọc" Icon="ApplicationGo" ToolTip="Chọn lọc theo ngày đặt hàng">
                            <DirectEvents>
                                <Click OnEvent="btnFillter_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event">
                                        <EventMask ShowMask="true" Msg="Đang tải..." />
                                </TriggerClick>
                                <SpecialKey OnEvent="Search_Event" Before="return e.getKey() == Ext.EventObject.ENTER;">
                                        <EventMask ShowMask="true" Msg="Đang tải..." />
                                </SpecialKey>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="StoreOrderServicesMaintain" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
<ext:Panel runat="server">
    <Content>
        <%-----------WindowsOrderServicesMaintain-----------------%>
        <ext:Window ID="WindowsOrderServicesMaintain" runat="server"
            Title="Cập nhật phiếu bảo hành"
            Width="975"
            Height="583"
            Hidden="True"
            Region="Center"
            Modal="True"
            HideMode="Display"
            BOrderServicesMaintain="False"
            Padding="5"
            DefaultButton="btnSavePopUp"
            Resizable="True">
            <Items>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Lưu lại" Icon="Disk" ID="btnSavePopUp">
                            <DirectEvents>
                                <Click OnEvent="btnSavePopUp_Click" Before="return #{FormPanelOrderServicesMaintain}.isValid();">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Xoá vật tư" Icon="Cancel" ID="btnDelMaterial" MarginSpec="0 8 0 0">
                            <DirectEvents>
                                <Click OnEvent="btnDelMaterial_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá vật tư này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Huỷ bỏ" Icon="Decline" ID="btnCancelPopUp">
                            <DirectEvents>
                                <Click OnEvent="btnCancelPopUp_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:TextField ID="txtMaintain_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                        <ext:TextField ID="txtSell_Id" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                        <ext:TextField ID="txtCustomerID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                    </Items>
                </ext:Toolbar>
                <ext:Panel
                    runat="server" 
                    Layout="ColumnLayout">
                    <Items>
                        <ext:Panel
                        runat="server" 
                        Width="218"
                        Frame="True"
                        MarginSpec="0 5 0 0"
                        Height="520">
                        <Items>
                            <ext:FormPanel ID="FormPanelOrderServicesMaintain" runat="server"
                                AutoHeight="true"
                                BodyPadding="4"
                                Frame="true"
                                DefaultAnchor="100%">
                                <Items>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã phiếu bảo hành" />
                                    <ext:FieldContainer
                                            runat="server"
                                            AnchorHorizontal="100%"
                                            Layout="HBoxLayout">
                                            <Items>
                                                <ext:TextField ID="txtOrderServicesMaintainCode" runat="server" AllowBlank="False" Width="165" Margins="8 3 0 0" />
                                                <ext:Button runat="server" Text="" Icon="Reload" ID="btnRefreshOrderServicesMaintainCode" ToolTip="Click vào để tải lại mã" Margins="8 3 0 0">
                                                    <DirectEvents>
                                                        <Click OnEvent="btnRefreshOrderServicesMaintainCode_Click">
                                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                            </Items>
                                        </ext:FieldContainer>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="CT bán hàng" />
                                    <ext:FieldContainer
                                            runat="server"
                                            AnchorHorizontal="100%"
                                            Layout="HBoxLayout">
                                            <Items>
                                                <ext:TextField ID="txtOrder_Code" ReadOnly="True" runat="server" AllowBlank="True" Width="165" Margins="8 3 0 0" />
                                                <ext:Button runat="server" Text="" Icon="BulletGet" ID="btnAddOrderCode" ToolTip="Đến danh sách" Margins="8 3 0 0">
                                                    <DirectEvents>
                                                        <Click OnEvent="btnAddOrderCode_Click">
                                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                            </Items>
                                        </ext:FieldContainer>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ngày lập phiếu" Margins="8 3 0 0" />
                                    <ext:DateField ID="txtDateBegin" runat="server" AllowBlank="False" Width="250" MarginSpec="8 3 5 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã số thuế" Margins="0 3 8 0" />
                                    <ext:TextField ID="txtTaxCode" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã khách hàng" MarginSpec="8 3 8 0" />
                                    <ext:TextField ID="txtCustomerAlias" ReadOnly="True" AllowBlank="False" runat="server" Width="250" MarginSpec="8 3 8 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Tên khách hàng" MarginSpec="8 3 8 0" />
                                    <ext:TextField ID="txtCustomerName" ReadOnly="True" Width="250" AllowBlank="False" runat="server" MarginSpec="8 3 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Địa chỉ" MarginSpec="0 3 8 0" />
                                    <ext:TextField ID="txtCustomerAddress" ReadOnly="True" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ghi chú" MarginSpec="0 3 8 0" />
                                    <ext:TextArea ID="txtDescription" runat="server" AnchorHorizontal="100%" Height="120" MarginSpec="5 0 0 0"/>
                                </Items>
                            </ext:FormPanel>
                        </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        Layout="Fit" 
                        Border="False"
                        Height="455">
                            <Items>
                                <ext:GridPanel
                                ID="grOrderServicesMaintain_Detail"
                                Cls="grid-double"
                                runat="server"
                                EnableColumnMove="true"
                                AutoWidth="true"
                                AutoScroll="true"
                                Layout="Fit"
                                Height="195">
                                <Store>
                                    <ext:Store
                                        ID="StoreOrderServicesMaintain_Detail"
                                        runat="server"
                                        OnReadData="StoreOrderServicesMaintain_Detail_RefreshData">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="Maintain_Detail_ID">
                                                <Fields>
                                                    <ext:ModelField Name="ID_Sell" Type="Int" />
                                                    <ext:ModelField Name="Sell_Code" Type="String" />
                                                    <ext:ModelField Name="Customer_ID" Type="Int" />
                                                    <ext:ModelField Name="Customer_Alias" Type="String" />
                                                    <ext:ModelField Name="Customer_Name" Type="String" />
                                                    <ext:ModelField Name="Maintain_DateEnd" Type="Date" />
                                                    <ext:ModelField Name="Maintain_ID" Type="Int" />
                                                    <ext:ModelField Name="ID_Sell_Detail" Type="Int" />
                                                    <ext:ModelField Name="Materials_Alias" Type="String" />
                                                    <ext:ModelField Name="Materials_Name" Type="String" />
                                                    <ext:ModelField Name="Materials_Type_Id" Type="Int" />
                                                    <ext:ModelField Name="Materials_Type_Alias" Type="String" />
                                                    <ext:ModelField Name="Materials_Type_Name" Type="String" />
                                                    <ext:ModelField Name="Expiration_Date" Type="String" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Text="STT" runat="server" Width="30" Align="Center" />
                                        <ext:Column runat="server" Text="Mã hàng" Width="100" DataIndex="Materials_Alias" />
                                        <ext:Column runat="server" Text="Tên hàng" Width="150" DataIndex="Materials_Name" />
                                        <ext:Column runat="server" Text="Loại hàng hoá" Width="150" DataIndex="Materials_Type_Name" />
                                        <ext:DateColumn runat="server" Text="TG bảo hành" DataIndex="Maintain_DateEnd" Format="dd-MM-yyyy" Align="Center" Width="150">
                                            <Editor>
                                                <ext:DateField
                                                runat="server" 
                                                AllowBlank="False" 
                                                Format="dd/MM/yyyy"
                                                MinDate="01.01.2006" 
                                                MinText="Ngày bảo hành phải lớn hơn ngày bán hàng" 
                                                Text="<%# DateTime.Now %>"
                                                AutoDataBind="true"
                                                />
                                            </Editor>
                                        </ext:DateColumn>
                                        <ext:Column runat="server" Text="TG còn lại" DataIndex="Expiration_Date" Align="Center" Width="128"/>
                                    </Columns>
                                </ColumnModel>
                                <Plugins>
                                    <ext:RowEditing runat="server" SaveBtnText="Cập nhật" CancelBtnText="Hủy bỏ">
                                        <DirectEvents>
                                            <Edit OnEvent="UpdateMaterials_Click">
                                                <EventMask ShowMask="true" Msg="Đang tải..." />
                                                <ExtraParams>
                                                    <ext:Parameter Name="grOrderServicesMaintain_Detail" Value="Ext.encode(#{grOrderServicesMaintain_Detail}.getRowsValues({selectedOnly : true}))" Mode="Raw" />
                                                </ExtraParams>
                                            </Edit>
                                        </DirectEvents>
                                    </ext:RowEditing>
                                </Plugins>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
                                </SelectionModel>
                                <DockedItems>
                                    <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                                        <Items>
                                            <ext:PagingToolbar runat="server" StoreID="StoreOrderServicesMaintain_Detail" EmptyMsg="Không có dữ liệu" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                                        </Items>
                                    </ext:Toolbar>
                                </DockedItems>
                            </ext:GridPanel>
                            </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        MarginSpec="5 0 0 0"
                        BOrderServicesMaintain="True"
                        Frame="True"
                        Height="56">
                            <Items>
                                <ext:FieldContainer
                                runat="server"
                                AnchorHorizontal="100%">
                                <Items>
                                    <ext:Label runat="server" Text="Tổng số lượng vật tư quá hạn:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbTotalOver" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>
                                </Items>
                            </ext:FieldContainer>
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Window>
        <%--------------Order-----------------%>
        <ext:Window ID="WindowOrderWithOrder" runat="server"
            Title="Thông tin đơn bán hàng"
            DefaultAnchor="100%"
            Width="829"
            Height="400"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="False"
            Modal="true"
            Layout="Fit"
            HideMode="Offsets"
            Constrain="True">
            <Content>
                <ext:GridPanel
                    ID="grOrderWithOrder"
                    BOrderServicesMaintain="True"
                    runat="server"
                    AutoWidth="true"
                    AutoScroll="true"
                    Cls="gird"
                    EnableColumnMove="true">
                    <Store>
                        <ext:Store
                            ID="StoreOrderWithOrder"
                            runat="server"
                            OnReadData="StoreOrderWithOrder_RefreshData"
                            PageSize="14">
                            <Model>
                                <ext:Model runat="server" IDProperty="ID_Sell_Detail">
                                    <Fields>
                                        <ext:ModelField Name="ID_Sell" Type="Int" />
                                        <ext:ModelField Name="Materials_Id" Type="Int" />
                                        <ext:ModelField Name="Materials_Alias" Type="String" />
                                        <ext:ModelField Name="Materials_Name" Type="String" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                            <ext:RowNumbererColumn runat="server" Width="30" Align="Center" />
                            <ext:Column runat="server" Text="Mã hàng" Width="200" DataIndex="Materials_Alias"></ext:Column>
                            <ext:Column runat="server" Text="Tên hàng" Width="100" DataIndex="Materials_Name" Align="Left" Flex="1"></ext:Column>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
                    </SelectionModel>
                    <DockedItems>
                        <ext:Toolbar runat="server" Dock="Top">
                            <Items>
                                <ext:Button ID="btnChooseMaterials" runat="server" Text="Chọn vật tư" Icon="ApplicationAdd">
                                    <DirectEvents>
                                        <Click OnEvent="btnChooseMaterials_Click">
                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                                <ext:ToolbarSeparator />
                                <ext:SelectBox
                                    ID="SelectBoxSell"
                                    runat="server"
                                    Cls="x-select-box"
                                    DisplayField="Sell_Code"
                                    ValueField="ID_Sell"
                                    MarginSpec="0 8 0 0"
                                    EmptyText="Chọn chứng từ ">
                                    <Store>
                                        <ext:Store ID="StoreSelectBoxSell" runat="server">
                                            <Model>
                                                <ext:Model ID="Model4" runat="server">
                                                    <Fields>
                                                        <ext:ModelField Name="Sell_Code" />
                                                        <ext:ModelField Name="ID_Sell" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                    <DirectEvents>
                                        <Select OnEvent="SelectBoxSell_Change">
                                            <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                        </Select>
                                    </DirectEvents>
                                </ext:SelectBox>
                            </Items>
                        </ext:Toolbar>
                        <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                            <Items>
                                <ext:PagingToolbar ID="PagingToolbar3" runat="server" StoreID="StoreOrderWithOrder" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                            </Items>
                        </ext:Toolbar>
                    </DockedItems>
                </ext:GridPanel>
            </Content>
        </ext:Window>
        <%-----------Review-----------------%>
        <ext:Window ID="WindowReview" runat="server"
            Title="Xét duyệt phiếu bảo hành"
            Width="975"
            Height="583"
            Hidden="True"
            Region="Center"
            Modal="True"
            HideMode="Display"
            BOrderServicesMaintain="False"
            Padding="5"
            DefaultButton="btnSavePopUp"
            Resizable="True">
            <Items>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Xét duyệt" Icon="Accept" ID="btnReview">
                            <DirectEvents>
                                <Click OnEvent="btnReview_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                        <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnReview"></ext:Parameter>
                                    </ExtraParams>
                                        <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xét duyệt mẫu phiếu này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Bỏ xét duyệt" Icon="Cancel" ID="btnUnReview" MarginSpec="0 8 0 0">
                            <DirectEvents>
                                <Click OnEvent="btnUnReview_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnUnReview"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn huỷ xét duyệt mẫu phiếu này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:TextField ID="txtReviewMaintain_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="True" />
                    </Items>
                </ext:Toolbar>
                <ext:Panel
                    runat="server" 
                    Layout="ColumnLayout">
                    <Items>
                        <ext:Panel
                        runat="server" 
                        Width="218"
                        Frame="True"
                        MarginSpec="0 5 0 0"
                        Height="520">
                        <Items>
                            <ext:FormPanel
                                runat="server"
                                AutoHeight="true"
                                BodyPadding="4"
                                Frame="true"
                                DefaultAnchor="100%">
                                <Items>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã phiếu bảo hành" />
                                    <ext:TextField ID="txtReviewCode" runat="server" ReadOnly="True" AnchorHorizontal="100%" Margins="8 3 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="CT bán hàng" />
                                    <ext:TextField ID="txtReviewSellCode" ReadOnly="True" runat="server" AnchorHorizontal="100%" Margins="8 3 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ngày lập phiếu" Margins="8 3 0 0" />
                                    <ext:DateField ID="txtReviewDateBegin" ReadOnly="True" runat="server" Width="250" MarginSpec="8 3 5 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã số thuế" Margins="0 3 8 0" />
                                    <ext:TextField ID="txtReViewTaxCode" ReadOnly="True" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã khách hàng" MarginSpec="8 3 8 0" />
                                    <ext:TextField ID="txtReviewCustomerAlias" ReadOnly="True" runat="server" Width="250" MarginSpec="8 3 8 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Tên khách hàng" MarginSpec="8 3 8 0" />
                                    <ext:TextField ID="txtReviewCustomerName" ReadOnly="True" Width="250" runat="server" MarginSpec="8 3 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Địa chỉ" MarginSpec="0 3 8 0" />
                                    <ext:TextField ID="txtReviewAddress" ReadOnly="True" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ghi chú" MarginSpec="0 3 8 0" />
                                    <ext:TextArea ID="txtReviewNote" runat="server" ReadOnly="True" AnchorHorizontal="100%" Height="120" MarginSpec="5 0 0 0"/>
                                </Items>
                            </ext:FormPanel>
                        </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        Layout="Fit" 
                        Border="False"
                        Height="455">
                            <Items>
                                <ext:GridPanel
                                ID="grServiceReview"
                                Cls="grid-double"
                                runat="server"
                                EnableColumnMove="true"
                                AutoWidth="true"
                                AutoScroll="true"
                                Layout="Fit"
                                Height="195">
                                <Store>
                                    <ext:Store
                                        ID="StoreServiceReview"
                                        runat="server"
                                        OnReadData="StoreServiceReview_Detail_RefreshData">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="Maintain_Detail_ID">
                                                <Fields>
                                                    <ext:ModelField Name="ID_Sell" Type="Int" />
                                                    <ext:ModelField Name="Sell_Code" Type="String" />
                                                    <ext:ModelField Name="Customer_ID" Type="Int" />
                                                    <ext:ModelField Name="Customer_Alias" Type="String" />
                                                    <ext:ModelField Name="Customer_Name" Type="String" />
                                                    <ext:ModelField Name="Maintain_DateEnd" Type="Date" />
                                                    <ext:ModelField Name="Maintain_ID" Type="Int" />
                                                    <ext:ModelField Name="ID_Sell_Detail" Type="Int" />
                                                    <ext:ModelField Name="Materials_Alias" Type="String" />
                                                    <ext:ModelField Name="Materials_Name" Type="String" />
                                                    <ext:ModelField Name="Materials_Type_Id" Type="Int" />
                                                    <ext:ModelField Name="Materials_Type_Alias" Type="String" />
                                                    <ext:ModelField Name="Materials_Type_Name" Type="String" />
                                                    <ext:ModelField Name="Expiration_Date" Type="String" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Text="STT" runat="server" Width="30" Align="Center" />
                                        <ext:Column runat="server" Text="Mã hàng" Width="100" DataIndex="Materials_Alias" />
                                        <ext:Column runat="server" Text="Tên hàng" Width="150" DataIndex="Materials_Name" />
                                        <ext:Column runat="server" Text="Loại hàng hoá" Width="150" DataIndex="Materials_Type_Name" />
                                        <ext:DateColumn runat="server" Text="TG bảo hành" DataIndex="Maintain_DateEnd" Format="dd-MM-yyyy" Align="Center" Width="150"/>
                                        <ext:Column runat="server" Text="TG còn lại" DataIndex="Expiration_Date" Align="Center" Width="128"/>
                                    </Columns>
                                </ColumnModel>
                                <DockedItems>
                                    <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                                        <Items>
                                            <ext:PagingToolbar runat="server" StoreID="StoreServiceReview" EmptyMsg="Không có dữ liệu" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                                        </Items>
                                    </ext:Toolbar>
                                </DockedItems>
                            </ext:GridPanel>
                            </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        MarginSpec="5 0 0 0"
                        BOrderServicesMaintain="True"
                        Frame="True"
                        Height="56">
                            <Items>
                                <ext:FieldContainer
                                runat="server"
                                AnchorHorizontal="100%">
                                <Items>
                                    <ext:Label runat="server" Text="Tổng số lượng vật tư quá hạn:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbTotalReview" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>
                                </Items>
                            </ext:FieldContainer>
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Window>
    </Content>
</ext:Panel>